import {uuidv4, randNum, randTrue} from '@huxy/utils';

const userSchema = {
  name: 'demo',
  email: 'demo@gmail.com',
  password: '123456',
  role: 2,
  token: uuidv4(),
  projectName: 'demo',
  projectId: 'demo-1',
  description: 'demo',
  active: 1,
  createtime: +new Date(),
  updatetime: +new Date(),
  creator: 'huy',
  updater: 'huy',
  avatar: 'https://pic2.zhimg.com/a2e68681a006bd3e60fd5b22d51cb629_im.jpg',
  github: '',
};

const routerSchema = {
  path: '',
  projectId: 'demo-1',
  parentId: '',
  name: '',
  iconKey: '',
  redirect: '',
  hideMenu: false,
  denied: false,
  componentPath: '',
  component: '',
  isRoot: false,
  createtime: +new Date(),
  updatetime: +new Date(),
  creator: 'huy',
  updater: 'huy',
};

const routerList = [
  {
    parentId: '',
    path: '/',
    name: '首页',
    iconKey: 'HomeOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620635990643,
  },
  {
    parentId: '',
    path: '/user',
    name: '登录注册',
    iconKey: 'TeamOutlined',
    hideMenu: true,
    denied: false,
    creator: 'zys',
    createtime: 1620636017796,
  },
  {
    parentId: '',
    path: '/404',
    name: '404',
    hideMenu: true,
    denied: false,
    creator: 'zys',
    createtime: 1620636048186,
  },
  {
    parentId: '/user',
    path: '/user/signin',
    name: '登录',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636070080,
  },
  {
    parentId: '/user',
    path: '/user/signup',
    name: '注册',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636092363,
  },
  {
    parentId: '/user',
    path: '/user/verifyEmail',
    name: '验证邮箱',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636109839,
  },
  {
    parentId: '/user',
    path: '/user/setNewPwd',
    name: '重置密码',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636127522,
  },
  {
    parentId: '/',
    path: '/layout',
    name: '框架配置',
    iconKey: 'LayoutOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636154481,
    updater: 'zys',
    updatetime: 1624872133851,
  },
  {
    parentId: '/',
    path: '/projects',
    name: '项目管理',
    iconKey: 'ConsoleSqlOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636177773,
  },
  {
    parentId: '/',
    path: '/projects/add',
    name: '添加项目',
    hideMenu: true,
    denied: false,
    creator: 'zys',
    createtime: 1620636207200,
  },
  {
    parentId: '/',
    path: '/projects/edit/:id',
    name: '编辑项目',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636226823,
  },
  {
    parentId: '/',
    path: '/projects/router/:id',
    name: '项目路由设置',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636245820,
  },
  {
    parentId: '/',
    path: '/users',
    name: '用户管理',
    iconKey: 'UsergroupAddOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636267387,
  },
  {
    parentId: '/',
    path: '/users/add',
    name: '添加用户',
    hideMenu: true,
    denied: false,
    creator: 'zys',
    createtime: 1620636289415,
  },
  {
    parentId: '/',
    path: '/users/edit/:id',
    name: '编辑用户',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636307487,
  },
  {
    parentId: '/',
    path: '/users/auth/:id',
    name: '路由权限设置',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636329861,
  },
  {
    parentId: '/',
    path: '/profile',
    name: '个人中心',
    hideMenu: true,
    denied: false,
    creator: 'zys',
    createtime: 1620636349501,
  },
  {
    parentId: '/',
    path: '/dashboard',
    name: '仪表盘',
    iconKey: 'DashboardOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636376269,
  },
  {
    parentId: '/',
    path: '/pages',
    name: '页面设计',
    iconKey: 'DesktopOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636398998,
  },
  {
    parentId: '/',
    path: '/apis',
    name: '接口管理',
    iconKey: 'ClusterOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636421223,
  },
  {
    parentId: '/',
    path: '/docs',
    name: '文档管理',
    iconKey: 'FileMarkdownOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636442351,
  },
  {
    parentId: '/',
    path: '/i18n',
    name: '语言管理',
    iconKey: 'GlobalOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1620636467249,
  },
  {
    parentId: '/',
    path: '/apis/add',
    name: '添加接口',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1624690561030,
  },
  {
    parentId: '/',
    path: '/apis/edit/:id',
    name: '编辑接口',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1624690599153,
  },
  {
    parentId: '/',
    path: '/apis/test/:id',
    name: '接口测试',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1624690623384,
  },
  {
    parentId: '/',
    path: '/suspense',
    name: 'suspense',
    iconKey: 'CoffeeOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1624690670034,
  },
  {
    parentId: '/',
    path: '/canvas',
    name: '图形绘制',
    iconKey: 'AreaChartOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1624690702896,
  },
  {
    parentId: '/',
    path: '/editor',
    name: '富文本编辑器',
    iconKey: 'EditOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1624690737041,
  },
  {
    parentId: '/',
    path: '/low-code',
    name: '低代码',
    iconKey: 'CoffeeOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1626882549254,
  },
  {
    parentId: '/low-code',
    path: '/low-code/users/edit/:id',
    name: '编辑用户',
    hideMenu: true,
    denied: false,
    creator: 'zys',
    createtime: 1626882672292,
  },
  {
    parentId: '/low-code',
    path: '/low-code/users/add',
    name: '添加用户',
    hideMenu: true,
    denied: false,
    creator: 'zys',
    createtime: 1626882700289,
  },
  {
    parentId: '/low-code',
    path: '/low-code/users',
    name: '业务组件',
    iconKey: 'CodeOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1626882742565,
  },
  {
    parentId: '/low-code',
    path: '/low-code/ui',
    name: 'UI组件',
    iconKey: 'CodeOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1626882785052,
  },
  {
    parentId: '/low-code',
    path: '/low-code/dom',
    name: '原生dom',
    iconKey: 'CodeOutlined',
    hideMenu: false,
    denied: false,
    creator: 'zys',
    createtime: 1626882800008,
  },
];

export const fakeUsers = (schema, num = 10) =>
  [...Array(num)].map((item, index) => ({...schema, _id: uuidv4(), name: `${schema.name}-${index + 1}`, email: `${schema.name}${index + 1}@gmail.com`, role: randNum(5), active: randTrue()}));

export const users = fakeUsers(userSchema, 36);

export const routers = routerList.map((route) => ({...routerSchema, ...route, _id: uuidv4()}));
